package com.wntms.zjy.dao;

import com.wntms.wy.pojo.FreightInformation;
import com.wntms.zjy.pojo.CustomerIn;
import com.wntms.zjy.pojo.CustomerInformation;
import com.wntms.zjy.pojo.FreightContract;
import com.wntms.zjy.pojo.FreightStatus;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author xzbz
 * @create 2022-11-24 11:59
 */
@Mapper
public interface FreightContractDaoz {

    @Results({
            @Result(id = true,property = "fid",column = "fid"),
            @Result(property = "fare",column = "fare"),
            @Result(property = "insurancefare",column = "insurancefare"),
            @Result(property = "auditstatus",column = "auditstatus"),
            @Result(property = "pay",column = "pay"),
            @Result(property = "sdate",column = "sdate"),
            @Result(property = "fiid",column = "fiid"),
            @Result(property = "uid",column = "uid"),
            @Result(property = "ciid",column = "ciid"),
            @Result(property = "fsid",column = "fsid"),
            @Result(property = "occurtime",column = "occurtime"),
            @Result(property = "refundtype",column = "refundtype"),
            @Result(property = "payment",column = "payment"),
            @Result(property = "coid",column = "coid"),
            @Result(property = "customerIn",column = "coid",javaType = CustomerIn.class,one = @One(select = "com.wntms.zjy.dao.CustomerInDaoz.findById")),
            @Result(property = "fsid",column = "fsid"),
            @Result(property = "freightStatus",column = "fsid",javaType = FreightStatus.class,one = @One(select= "com.wntms.zjy.dao.FreightStatusDaoz.findById"))
    })
    @Select("select * from freight_contract where fid = #{fid}")
    public FreightContract findById(String fid);

    @Results({
            @Result(id = true,property = "fid",column = "fid"),
            @Result(property = "fare",column = "fare"),
            @Result(property = "insurancefare",column = "insurancefare"),
            @Result(property = "auditstatus",column = "auditstatus"),
            @Result(property = "pay",column = "pay"),
            @Result(property = "sdate",column = "sdate"),
            @Result(property = "fiid",column = "fiid"),
            @Result(property = "uid",column = "uid"),
            @Result(property = "ciid",column = "ciid"),
            @Result(property = "fsid",column = "fsid"),
            @Result(property = "occurtime",column = "occurtime"),
            @Result(property = "refundtype",column = "refundtype"),
            @Result(property = "payment",column = "payment"),
            @Result(property = "coid",column = "coid"),
            @Result(property = "customerIn",column = "coid",javaType = CustomerIn.class,one = @One(select = "com.wntms.zjy.dao.CustomerInDaoz.findById")),
            @Result(property = "fsid",column = "fsid"),
            @Result(property = "freightStatus",column = "fsid",javaType = FreightStatus.class,one = @One(select= "com.wntms.zjy.dao.FreightStatusDaoz.findById"))
    })
    @Select("select * from freight_contract")
    public List<FreightContract> findAll();

    @Select("select count(*) from freight_contract")
    public Integer findCount();
}
